<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib prefix="s"  uri="/struts-tags"%>
<%@ page isELIgnored="false" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

 <script type="text/javascript" src="<%=basePath %>/scripts/jquery/jquery-1.6.2.min.js"></script>  
 <script type="text/javascript" src="<%=basePath %>/scripts/jquery/json.js"></script>  
<html>
<head>
	<title>Ajax</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link href="<%=basePath%>/css/displaytag.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath%>/css/screen.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript"  type="text/javascript">
  	  function getFourVersion(){
               var params = {
                           modelName:$("#modelName").val(),
                           projectName:$("#projectName").val(),
                           space:$("#space").val()               
                       }; //通过id获得输入值
                       
			 $.ajax( {
			    url :"loadThreeVersion.action",
			    type :"post",
			    dataType :"json",
			    data :params,
			    contentType: "application/x-www-form-urlencoded; charset=utf-8",
			   // timeout :20000,// 设置请求超时时间（毫秒）。
			   // error : function() {},// 请求失败时调用函数。
			     success :callbackFun
			   });
	    };
	    function callbackFun(data){
	    	var dataObj=eval("("+data+")");//转换为json对象
	    	$("#fourVersion").empty();
	        $.each(dataObj,function(i, n){
	  	         option=document.createElement("OPTION");
	  	         option.value=n;
	  	         option.text=n;
	  	         document.all.fourVersion.options.add(option);
	        });
	  	   };
          ////////////////////////////////////////////////////////////////////////////	  	   
	  	  function loadInfo(){
	  	   var params = {
                           modelName:$("#modelName").val(),
                           projectName:$("#projectName").val(),
                           space:$("#space").val(),
                           fourVersion:$("#fourVersion").val()               
                       }; //通过id获得输入值
                       
			 $.ajax( {
			    url :"loadShowData.action",
			    type :"post",
			    //dataType :"json",
			    data :params,
			    contentType: "application/x-www-form-urlencoded; charset=utf-8",
			   // timeout :20000,// 设置请求超时时间（毫秒）。
			   // error : function() {},// 请求失败时调用函数。
			     success :function(data){
			     	$("#info").html(data);
			     }
			   });
	    };
</script>
    
<body>
       <div class="topic">数据展现 </div>
       <table>
       <tbody>
       <tr>
       <td class="Item">项目名称:${projectName}</td>
       <td>
       <input type="hidden" name="space" value="${space}" id="space"></input>
       <input type="hidden" name="projectName" value="${projectName}" id="projectName"></input>
       </td>
       <td class="Item">模块名称</td>
       <td>
       <select  name="modelName" id="modelName" onchange="getFourVersion()">
             <option value="">请点击选择版本号   </option>
              <s:iterator value="#request.modelList" var="strs">
                 <option value="<s:property value="#strs"/>"> <s:property value="#strs"/></option>
              </s:iterator> 
        </select>
     </td>
       <td class="Item">版本号：</td>
       <td>
       <select name="fourVersion"  id="fourVersion"></select>
       </td>
         <td align="center">
         <input type="button" name="btn_query" value="查询" onclick="loadInfo()"></td>
       </tr>
       </tbody>
       </table>
	 <div id="info"></div>
 </body>
</html>
